package com.youlu.campus.service.ranking;

import com.youlu.campus.entity.VO.res.ActivityRankingPointsVO;
import com.youlu.campus.service.ranking.entity.UserActivityPointRanking;
import com.youlu.campus.entity.UserPO;
import com.youlu.campus.entity.VO.RankingListQueryVO;
import com.youlu.campus.entity.VO.req.RankingListResVO;
import com.youlu.campus.service.ranking.entity.UserActivityPointRankingQueryVo;
import org.springframework.data.domain.Page;

public interface UserActivityPointRankingService {
    /**
     * 积分排行榜
     *
     * @param req
     * @param userPO
     * @return
     */
    RankingListResVO getUserTaskRanking(RankingListQueryVO req, UserPO userPO);

    /**
     * 积分排行榜
     *
     * @param req
     * @return
     */
    Page<UserActivityPointRanking> getUserActivityRanking(RankingListQueryVO req);

    /**
     * 更新积分
     *
     * @param userPO
     * @param activityId
     * @param point
     */
    void updatePoint(UserPO userPO, String activityId, Integer point);

    /**
     * 查询积分数据
     *
     * @param userId
     * @param activityId
     * @return
     */
    UserActivityPointRanking find(String userId, String province, String activityId);

    /**
     * 通过用户userId 活动ID查询用户积分活活力值
     *
     * @param userId
     * @param activityId
     * @return
     */
    UserActivityPointRanking findByUserIdAndActivityId(String userId, String activityId);

    /**
     * 判断是否有积分/贡献值
     *
     * @param userId
     * @param activityId
     * @param bizType
     * @return
     */
    boolean hasPoint(String userId, String activityId, String bizType);

    /**
     * 扣减活力值
     *
     * @param userId
     * @param activityId
     * @param requiredPoint
     * @return
     */
    boolean subPoint(String userId, String activityId, Integer requiredPoint);


    String getRankPreKey();

    /**
     * 获取全国榜缓存的Key
     * @param activityId
     * @return
     */
    String getRankKey(String activityId);

    /**
     * 分页查询
     *
     * @param queryVo
     * @return
     */
    Page<ActivityRankingPointsVO> findByPage(UserActivityPointRankingQueryVo queryVo);
}
